@model WalkingTec.Mvvm.Core.BaseVM
<style>

    a {
        color: #01aaed
    }
</style>
<wt:fieldset field-set-style="Simple" title=" User customize">
    <wt:quote>
        <p>The framework comes with user management functionallity.However, first problem for many people when they use WTM is that ‘more fields are needed in user structure’</p>
        <p>Following tutorial shows how to add fields to the user by writing your own user model which inherits from WTM base User class</p>
    </wt:quote>
    <ul class="doc">
        <li>
            First, we create a new class for the User in the model project, which inherits from the ‘FrameworkUserBase’<br /><br />

            <wt:code title="School.cs">
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;

namespace YourNameSpace.Models
{
    [Table("FrameworkUsers")]
    public class MyUser : FrameworkUserBase
    {
        [Display(Name = "Extra info1")]
        public string Extra1 { get; set; }

        [Display(Name = "Extra info2")]
        public string Extra2 { get; set; }
    }
}
            </wt:code>
        </li>
        <li>
            The above code will add 2 new fields to the 'FrameworkUsers' table.<br />
            In ‘DataAccess’ project, modify the ‘DataContext’ class and add ‘MyUser’. Since ‘MyUser’ inherits from the FrameworkUserBase, instead of adding new table,it will add a column called ‘Discriminator’ in the FrameworkUser table. This is the EF rule.<br /><br />
            <wt:code title="DataContext.cs">
public class DataContext : FrameworkContext
{
    public DbSet&ltMyUser&gt MyUsers { get; set; }

    public DataContext(string cs, DBTypeEnum dbtype)
    : base(cs, dbtype)
    {
    }
}
            </wt:code>
        </li>
        <li>
            Press F5 to regenerate the user table.<br /><br />
            <wt:quote>
                <p>Because of the added Discriminator field, you need to update the database or use a new library name for EF to generate automatically.</p>
            </wt:quote>
        </li>
        <li>
            Then, just like you generated other modules, use the code generator to generate module for ‘MyUser’.<br /><br />
        </li>
        <li>
            In the code generator, select ‘MyUser’, name the  module something like ‘Customized user management’.<br /><br />
        </li>
        <li>
            After the code is generated, close the browser and restart the application. We can see ‘Customized user management’on the left menu which is no different from the one provided by the framework, but it has new fields that you needed.<br />
            <wt:quote>
                <p>The only thing that needs to be modified is that the login uses MD5 authentication. So before you add ‘Myuser’, remember to add : ‘entity.password = utilities.getmd5string (entity. Password)’;Encrypt MD5</p>
                <p>You can't see the default system admin in ‘Customized user management’. Because EF uses the Discriminator field to determine which class the data belongs to. You can manually change admin field from ‘Discriminator’ to ‘Myuser’. You can also delete the admin directly and add a new administrator account.</p>
            </wt:quote>
        </li>
        <li>
            Go to menu management, change the original user management not  to displayand add the new user management to the menu.<br />
            In non-debugging mode (in Appsettings file, isquickdebug = false )，the menu on the left becomes your new user management.<br />
        </li>
    </ul>
</wt:fieldset>
<script>
layui.use('code',function(){layui.code({ about: false })})
</script>
<script>
  $("#@Model.ViewDivId").parent().css("height", "auto");
</script>
